package graphic.complex;

import graphic.primitives.general.GraphicObject;
import graphic.primitives.general.IGraphicObject;
import graphic.primitives.town.Building;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;

/**
 *
 * @author Tomas Zima
 */
public class Town extends GraphicObject implements IGraphicObject
{
	public Town(int x, int y, int width)
	{
		super(x, y);
		this.width = width;
		
		for (int i = 0; i < width; i += 100)
		{
			buildings.add(new Building(x + i, y, 100, (new Random().nextInt(100)) + 100));
		}
	}

	@Override
	public void redraw()
	{
		for (int i = 0; i < buildings.size(); i++)
		{
			buildings.get(i).redraw();
		}
	}
	
	private int				width;
	private List<Building>	buildings = new LinkedList<Building>();
}
